package com.zy.garbage.exception;

import com.zy.garbage.util.ResultUtil;
import com.zy.garbage.vo.ResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class CommonExceptionHandler {

    @ExceptionHandler(value = CommonException.class)
    @ResponseBody
    public ResultVO error(CommonException e){
        return  ResultUtil.error(e.getCode(),e.getMessage());
    }
}
